#!/bin/bash

voxceleb1_path=/ceph/home/zhangy20/datasets/VoxCeleb/voxceleb1
trials_path=data/trials.lst

nnet_type=ResNetSE34L
loss_type=amsoftmax

ckpt_path=ckpt.pt

. ./path.sh

stage=1
echo stage $stage

# format data dir structure by soft link
if [ $stage -eq 0 ];then
    if [ ! -d data/wav_files ]; then
        mkdir -p data/wav_files
    fi
    rm -rf $trials_path

    wget https://openslr.magicdatatech.com/resources/49/voxceleb1_test_v2.txt
    mv voxceleb1_test_v2.txt data/voxceleb1_test_v2.txt
    python3 local/format_trials.py \
	    --voxceleb1_root $voxceleb1_path \
	    --src_trials_path data/voxceleb1_test_v2.txt \
	    --dst_trials_path $trials_path
fi

if [ $stage -eq 1 ];then
    CUDA_VISIBLE_DEVICES=3 python3 -W ignore $SPEAKER_TRAINER_ROOT/adversal_attack.py \
        --nnet_type $nnet_type \
        --num_workers 100 \
        --trials_path data/trials.lst \
        --gpus 1 \
        --max_frames 401 --min_frames 400 \
        --checkpoint_path $ckpt_path \
        --evaluate
   rm -rf lightning_logs
fi

